package com.commonClass.MathClass;

public class TestMath {
    public static void main(String[] args) {
        //圆周率
        System.out.println(Math.PI);//3.141592653589793

        //绝对值
        System.out.println(Math.abs(-4));//4

        //ceil天花板,向上取整 double
        System.out.println(Math.ceil(3.14));//4.0

        //floor 地板,向下取整 double
        System.out.println(Math.floor(3.14));//3.0

        //两数取大者
        System.out.println(Math.max(10, 100));//100

        //平方 2^4
        System.out.println(Math.pow(2, 4));//16.0
        //开方
        System.out.println(Math.sqrt(100));//10.0

        //随机小数 [0.0,1.0)
        System.out.println(Math.random());
        //指定区间? 比如[0,100) 且为整数 +floor
        System.out.println(Math.floor(Math.random() * 100));

        //四舍五入
        System.out.println(Math.round(3.4));//3
        System.out.println(Math.round(3.6));//4


    }
}

    